//
//  SNOxDetailTableViewCell.m
//  project
//
//  Created by 黄建华 on 2017/12/8.
//  Copyright © 2017年 黄建华. All rights reserved.
//

#import "SNOxDetailTableViewCell.h"

@implementation SNOxDetailTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    
    return self;
}

- (void)createView {
    _dateLabel = [[UILabel alloc] init];
    [self addSubview:_dateLabel];
    
    _valueLabel = [[UILabel alloc] init];
    [self addSubview:_valueLabel];
    
    _lineView = [[UIView alloc] init];
    [self addSubview:_lineView];
}

- (void)updateOxCell:(NSArray *)value withSelectType:(SelectDateType)type {
    _dateLabel.frame     = SNFRAME(20, 0, 150, 33);
    _dateLabel.textColor = SNCOLORBLACK;
    _dateLabel.font      = SNFONTMEDIUM(16);
    
    _valueLabel.frame         = SNFRAME(HHHWIDTH - 120, 0, 100, 33);
    _valueLabel.textAlignment = NSTextAlignmentRight;
    _valueLabel.font          = SNFONTMEDIUM(16);
    
    _lineView.frame = SNFRAME(20, 40, screenWidth-20, 0.5);
    _lineView.backgroundColor = UIColorHEX(0xD9D9DD);
    
    NSString *sss = [value objectAtIndex:0];
    if (type == SelectDateDay) {
        sss             = [NSString subString:sss withToIndex:5];
        _dateLabel.text = sss;
    } else {
        _dateLabel.text = sss;
    }
    
    NSString *values = [value objectAtIndex:1];
    
    _valueLabel.text      = [NSString stringWithFormat:@"%@ %%", values];
    _valueLabel.textColor = SNCOLORBLACK;
}

@end

